package com.itheima.mapper;

import com.github.pagehelper.Page;

import com.itheima.dto.OrdersPageQueryDTO;
import com.itheima.dto.OrdersStatisticsDto;
import com.itheima.pojo.Orders;
import com.itheima.vo.OrderOverViewVO;
import com.itheima.vo.OrderReportVO;
import com.itheima.vo.OrderVO;
import com.itheima.vo.BusinessDataVO;
import com.itheima.vo.TurnoverReportVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper {
    /**
     * 订单分页查询
     * @param ordersPageQueryDTO
     * @return
     */
    Page<OrderVO> pageSelect(OrdersPageQueryDTO ordersPageQueryDTO);

    void add(Orders orders);

    void updateById(Orders orders);

    Page<OrderVO> pageSelectHistoryOrder(Orders orders);

    OrderVO findById(Orders orders);
    /**
     * 取消订单
     * @param order
     * @return
     */
    void updateOrderById(OrderVO order);

    void alterById(Orders orders);
    /**
     * 各个状态的订单数量统计
     * @return
     */
    List<Map> getcount();

    /**
     * 订单统计
     *
     * @param statisticsDto
     * @return
     */
    OrderReportVO orderStatistics(OrdersStatisticsDto statisticsDto);
    /**
     * 营业额统计接口
     * @param statisticsDto
     * @return
     */
    TurnoverReportVO turnoverStatistics(OrdersStatisticsDto statisticsDto);
    /**
     * 查询订单管理数据
     * @return
     */
    OrderOverViewVO overviewOrders();
    /**
     * 查询今日运营数据
     * @return
     */
    BusinessDataVO businessData();

    /**
     * 根据id查询订单
     * @param id
     * @return
     */
    @Select("select * from orders where id=#{id}")
    Orders getById(Long id);


    List<OrderVO> selectByStatusAndOrderDateTime(Integer status, LocalDateTime dateTime);



    BusinessDataVO getBusinessData(LocalDate begin, LocalDate end);


    BusinessDataVO getBusinessData(LocalDateTime begin, LocalDateTime end);


    List<BusinessDataVO> getData(LocalDate begin, LocalDate end);
}
